// 点击切换tab效果
function tab(id) {
    if (id == 1) {
        $("#1").addClass("active");
        $("#2").removeClass("active");
        $("#3").removeClass("active");
    } else if (id == 2) {
        $("#1").removeClass("active");
        $("#2").addClass("active");
        $("#3").removeClass("active");
    } else {
        $("#3").addClass("active");
        $("#1").removeClass("active");
        $("#2").removeClass("active");
    }
}
var lght = [];
function probox($scope, CertusFormAjax) {
    var status = $(".probox").css("display");
    lght.push($(window).scrollTop());
    $('html , body').animate({
        scrollTop: 0
    }, 'fast');
    if (status == "none") {
        $(".probox").show();
        $(".first").hide();
        CertusFormAjax.ajax("findProDetaiInfo", {
            "proId": $scope.proId
        }, function (response) {
            var data = response.data.proMap;
            $scope.proNo = data.pro_no;
            $scope.proName = data.pro_name;
            $scope.cusName = response.data.cusNames;
            $scope.deptName = data.deptName;
            var proType = data.pro_type;
            if (proType == "ZL") {
                $scope.proType = "战略类";
            } else if (proType == "YF") {
                $scope.proType = "研发类";
                $scope.isYfShow = true;
                $scope.divineVersionTime = data.divine_version_time;
            } else if (proType == "XS") {
                $scope.isShow = true;
                $scope.proType = "销售类";
            } else if (proType == "BM") {
                $scope.proType = "部门类";
            } else if (proType == "SW") {
                $scope.proType = "事务类";
            } else {
                $scope.proType = "测试类";
            }

            var proState = data.pro_state;
            if (proState == 1) {
                $scope.proState = "运行中";
            } else if (proState == 2) {
                $scope.proState = "已关闭";
            } else if (proState == 3) {
                $scope.proState = "已完结";
            } else {
                $scope.proState = "已暂停";
            }
            var psg = "";
            if (data.code == 1) {
                psg = "线索申请待审批";
            } else if (data.code == 2) {
                psg = "线索审批中";
            } else if (data.code == 3) {
                psg = "线索审批通过";
            } else if (data.code == 4) {
                psg = "线索审批不通过";
            } else if (data.code == 5) {
                psg = "项目立项待审批";
            } else if (data.code == 6) {
                psg = "立项审批中";
            } else if (data.code == 7) {
                psg = "立项审批通过";
            } else if (data.code == 8) {
                psg = "立项审批不通过";
            } else if (data.code == 9) {
                psg = "立项审批通过待商务预测";
            } else if (data.code == 10) {
                psg = "立项通过";
            } else if (data.code == 11) {
                psg = "发起投标待审批";
            } else if (data.code == 12) {
                psg = "投标审批中";
            } else if (data.code == 13) {
                psg = "投标审批通过";
            } else if (data.code == 14) {
                psg = "投标审批不通过";
            } else if (data.code == 15) {
                psg = "合同上传申请待审批";
            } else if (data.code == 16) {
                psg = "合同审批中";
            } else if (data.code == 17) {
                psg = "合同审批通过";
            } else if (data.code == 18) {
                psg = "合同审批不通过";
            } else if (data.code == 19) {
                psg = "验收结果上传";
            } else if (data.code == 20) {
                psg = "项目结束";
            }
            $scope.code = psg;
            if (data.stage_code == 0) {
                $scope.proStage = '线索申请阶段';
            }
            if (data.stage_code == 1) {
                $scope.proStage = '线索阶段';
            }
            if (data.stage_code == 2||data.stage_code == 3) {
                $scope.proStage = '运作阶段';
            }
            if (data.stage_code == 4) {
                $scope.proStage = '合同阶段';
            }
            if (data.stage_code == 5) {
                $scope.proStage = '交付阶段';
            }
            if (data.stage_code == 6) {
                $scope.proStage = '回款阶段';
            }

            var proLv = data.pro_lv;
            if (proLv == 3) {
                $scope.proLv = "高";
            } else if (proLv == 2) {
                $scope.proLv = "中";
            } else {
                $scope.proLv = "低";
            }
            $scope.divineSignDate = data.divine_sign_date;

            var isCompare = data.is_compare;
            if (isCompare == 1) {
                $scope.isCompare = "有";
            } else {
                $scope.isCompare = "无";
            }
            $scope.divineHkDate = data.divine_hk_date;

            $scope.startTime = data.startTime;
            $scope.endTime = data.endTime;
            // if (data.stage_code==1){
            //
            // }else {
            //     $scope.startTime = data.startTime2;
            //     $scope.endTime = data.endTime2;
            // }
            $scope.pdLines = response.data.deptNames;
            $scope.clueDesc = data.clue_desc;
            $scope.cusPolicy = data.cus_policy;
            $scope.competitor = data.competitor;

            $scope.xsUser="";
            $scope.mgUser="";
            $scope.pduUser="";
            $scope.delUser="";
            $scope.selUser="";

            var memberList = response.data.mebMap;
            for (var i = 0; i < memberList.length; i++) {
                var codes = memberList[i].proRoleCode.split(",");
                for (var j=0;j<codes.length;j++){
                    //indexOf 大小写敏感
                    if (codes[j].indexOf("XSFZR")>-1) {
                        $scope.xsUser += memberList[i].userName+" ";
                    }
                    if (codes[j].indexOf("XMJL")>-1) {
                        $scope.mgUser += memberList[i].userName+" ";
                    }
                    if (codes[j].indexOf("CPJL")>-1) {
                        $scope.pduUser += memberList[i].userName+" ";
                    }
                    if (codes[j].indexOf("JFJL")>-1) {
                        $scope.delUser += memberList[i].userName+" ";
                    }
                    if (codes[j].indexOf("XSJL")>-1) {
                        $scope.selUser += memberList[i].userName+" ";
                    }
                }
            }
        });

        // 项目目标
        var prointColumns = [{
            id: 'proTarget',
            title: '项目目标',
            type: 'string',
            columnClass: 'text-left',
        }, {
            id: 'finishTime',
            title: '完成时间',
            type: 'date',
            format: 'yyyy-MM-dd',
            otype: 'time_stamp_ms',
            width: 110,
            columnClass: 'text-center',
        }];
        $("#targetContainer").empty();
        CertusFormAjax.ajax("findTargets", {
            "proId": $scope.proId
        }, function (response) {
            var proinOption = {
                lang: 'zh-cn',
                ajaxLoad: false,
                extraWidth: 20,
                // loadURL:'url',
                exportFileName: '项目指标',
                datas: response.data,
                columns: prointColumns,
                gridContainer: 'targetContainer',
                tools: '',
            };
            var proinGrid = $.fn.dlshouwen.grid.init(proinOption);
            proinGrid.load();
        });

        // 项目指标
        var proinColumns2 = [{
            id: 'wntyName',
            title: '指标名称',
            type: 'string',
            width: 300,
            columnClass: 'text-left',
        }, {
            id: 'wntyDesc',
            title: '指标描述',
            type: 'string',
            columnClass: 'text-left',
        }, {
            id: 'finishTime',
            title: '完成时间',
            type: 'string',
            width: 110,
            columnClass: 'text-center',
        }];

        $("#indContainer").empty();
        CertusFormAjax.ajax("findWarnList", {
            "proId": $scope.proId
        }, function (response) {
            var proinOption = {
                lang: 'zh-cn',
                ajaxLoad: false,
                extraWidth: 20,
                // loadURL:'url',
                exportFileName: '项目指标',
                datas: response.data,
                columns: proinColumns2,
                gridContainer: 'indContainer',
                tools: ''
            };
            var proinGrid = $.fn.dlshouwen.grid.init(proinOption);
            proinGrid.load();
        });

        // 项目整体进展列表
        var prgColumns = [{
            id: 'createTime',
            title: '提交日期',
            type: 'date',
            format: 'yyyy-MM-dd',
            otype: 'time_stamp_ms',
            width: 110,
            columnClass: 'text-center'
        }, {
            id: 'content',
            title: '项目整体进展',
            type: 'string',
            width: 300,
            columnClass: 'text-left'
        }, {
            id: 'nextStep',
            title: '下一步计划',
            type: 'string',
            columnClass: 'text-left'
        }];
        $("#prgContainer").empty();
        $("#prgToolBarContainer").empty();
        CertusFormAjax.ajax("findReportList", {
            "proId": $scope.proId
        }, function (response) {
            var prgOption = {
                lang: 'zh-cn',
                ajaxLoad: false,
                extraWidth: 20,
                exportFileName: '项目整体进展',
                datas: response.data,
                columns: prgColumns,
                gridContainer: 'prgContainer',
                toolbarContainer: 'prgToolBarContainer',
                tools: '',
                pageSize: 10,
                pageSizeLimit: [10, 15, 20]
            };
            var prgGrid = $.fn.dlshouwen.grid.init(prgOption);
            prgGrid.load();
        });

        // 项目风险列表
        var riskColumns = [{
            id: 'createTime',
            title: '日期',
            width: 110,
            type: 'string',
            columnClass: 'text-center'
        }, {
            id: 'riskLv',
            title: '级别',
            type: 'string',
            width: 50,
            columnClass: 'text-center',
        }, {
            id: 'type',
            title: '风险状态',
            type: 'string',
            codeTable: status,
            width: 100,
            columnClass: 'text-center',
            resolution: function (value, record, column, grid, dataNo, columnNo) {
                var content = '';
                if (value == "1") {
                    content += '<span style="background:#d9534f;padding:2px 10px;color:white;">开启中</span>';
                }
                if (value == "0") {
                    content += '<span style="background:#5cb85c;padding:2px 10px;color:white;">已关闭</span>';
                }
                return content;
            }
        }, {
            id: 'riskContent',
            title: '风险和问题',
            type: 'string',
            width: 300,
            columnClass: 'text-left',
        }, {
            id: 'riskManage',
            title: '预规避和处理措施',
            type: 'string',
            columnClass: 'text-left',
        }];
        $("#riskContainer").empty();
        $("#riskToolBarContainer").empty();
        CertusFormAjax.ajax("findRiskList", {
            "proId": $scope.proId
        }, function (response) {
            var riskOption = {
                lang: 'zh-cn',
                ajaxLoad: false,
                extraWidth: 20,
                // loadURL:'url',
                exportFileName: '项目风险',
                datas: response.data,
                columns: riskColumns,
                gridContainer: 'riskContainer',
                toolbarContainer: 'riskToolBarContainer',
                tools: '',
                pageSize: 10,
                pageSizeLimit: [10, 15, 20]
            };
            var riskGrid = $.fn.dlshouwen.grid.init(riskOption);
            riskGrid.load();
        });
        findProData($scope, CertusFormAjax);
        //销售
        var lpColumns = [{
            id: 'krs_desc',
            title: '关键成果',
            type: 'string',
            columnClass: 'text-center',
        }, {
            id: 'rw_desc',
            title: '进展和困难',
            type: 'string',
            width: 350,
            columnClass: 'text-left',
        }, {
            id: 'next_plan',
            title: '下一步计划',
            type: 'string',
            width: 350,
            columnClass: 'text-left'
        }, {
            id: 'user_name',
            title: '负责人',
            type: 'string',
            width: 75,
            columnClass: 'text-center'
        }, {
            id: 'pro_role',
            title: '职位',
            type: 'string',
            width: 100,
            hideType: 'lg|md|sm|xs',
            columnClass: 'text-center'
        }, {
            id: 'update_time',
            title: '更新时间',
            type: 'date',
            width: 110,
            format: 'yyyy-MM-dd',
            otype: 'time_stamp_ms',
            columnClass: 'text-center'
        }];
        $("#lpxsContainer").empty();
        CertusFormAjax.ajax("findLpOkrs", {
            "proId": $scope.proId,
            "code": "XS"
        }, function (response) {
            var lpOption = {
                lang: 'zh-cn',
                ajaxLoad: false,
                extraWidth: 20,
                // loadURL:'url',
                exportFileName: '成员进展',
                datas: response.data,
                columns: lpColumns,
                gridContainer: 'lpxsContainer',
                tools: ''
            };
            var lpGrid = $.fn.dlshouwen.grid.init(lpOption);
            lpGrid.load();
        });

        //售前产品经理
        $("#lpxqcpjlContainer").empty();
        CertusFormAjax.ajax("findLpOkrs", {
            "proId": $scope.proId,
            "code": "XQGLZY"
        }, function (response) {
            var lpOption = {
                lang: 'zh-cn',
                ajaxLoad: false,
                extraWidth: 20,
                // loadURL:'url',
                exportFileName: '成员进展',
                datas: response.data,
                columns: lpColumns,
                gridContainer: 'lpxqcpjlContainer',
                tools: ''
            };
            var lpGrid = $.fn.dlshouwen.grid.init(lpOption);
            lpGrid.load();
        });
        //交付经理
        $("#lpjfjlContainer").empty();
        CertusFormAjax.ajax("findLpOkrs", {
            "proId": $scope.proId,
            "code": "JFJL"
        }, function (response) {
            var lpOption = {
                lang: 'zh-cn',
                ajaxLoad: false,
                extraWidth: 20,
                // loadURL:'url',
                exportFileName: '成员进展',
                datas: response.data,
                columns: lpColumns,
                gridContainer: 'lpjfjlContainer',
                tools: ''
            };
            var lpGrid = $.fn.dlshouwen.grid.init(lpOption);
            lpGrid.load();
        });
        //现场工程师
        $("#lpxcgcsContainer").empty();
        CertusFormAjax.ajax("findLpOkrs", {
            "proId": $scope.proId,
            "code": "RJJSGCS"
        }, function (response) {
            var lpOption = {
                lang: 'zh-cn',
                ajaxLoad: false,
                extraWidth: 20,
                // loadURL:'url',
                exportFileName: '成员进展',
                datas: response.data,
                columns: lpColumns,
                gridContainer: 'lpxcgcsContainer',
                tools: ''
            };
            var lpGrid = $.fn.dlshouwen.grid.init(lpOption);
            lpGrid.load();
        });

        //项目经理
        $("#lpxmjlContainer").empty();
        CertusFormAjax.ajax("findLpOkrs", {
            "proId": $scope.proId,
            "code": "XMJL"
        }, function (response) {
            var lpOption = {
                lang: 'zh-cn',
                ajaxLoad: false,
                extraWidth: 20,
                // loadURL:'url',
                exportFileName: '成员进展',
                datas: response.data,
                columns: lpColumns,
                gridContainer: 'lpxmjlContainer',
                tools: ''
            };
            var lpGrid = $.fn.dlshouwen.grid.init(lpOption);
            lpGrid.load();
        });

        //需求管理专员
        $("#lpxqglzyContainer").empty();
        CertusFormAjax.ajax("findLpOkrs", {
            "proId": $scope.proId,
            "code": "XQGLZY"
        }, function (response) {
            var lpOption = {
                lang: 'zh-cn',
                ajaxLoad: false,
                extraWidth: 20,
                // loadURL:'url',
                exportFileName: '成员进展',
                datas: response.data,
                columns: lpColumns,
                gridContainer: 'lpxqglzyContainer',
                tools: ''
            };
            var lpGrid = $.fn.dlshouwen.grid.init(lpOption);
            lpGrid.load();
        });

        //问题管理专员
        $("#lpwtContainer").empty();
        CertusFormAjax.ajax("findLpOkrs", {
            "proId": $scope.proId,
            "code": "WTGLZY"
        }, function (response) {
            var lpOption = {
                lang: 'zh-cn',
                ajaxLoad: false,
                extraWidth: 20,
                // loadURL:'url',
                exportFileName: '成员进展',
                datas: response.data,
                columns: lpColumns,
                gridContainer: 'lpwtContainer',
                tools: ''
            };
            var lpGrid = $.fn.dlshouwen.grid.init(lpOption);
            lpGrid.load();
        });
    } else {
        $(".probox").hide();
        $(".first").show();
        lght.pop();
        var top = lght[lght.length - 1];
        $('html , body').animate({
            scrollTop: top
        }, 'fast');
    }
}

function findProData($scope, CertusFormAjax) {
    var date = new Date;
    var year = date.getFullYear();
    this.phaseTjs = function (proId) {
        var totalRt = 0;
        var totalMoney = 0;
        CertusFormAjax.ajax('findPhaseTjs', {
            "param": proId,
            "year": year,
            "compCode": ""
        }, function (response) {
            var data = response.data;

            for (var i = 0; i < data.length; i++) {
                totalRt += data[i].actualday;
                totalMoney += data[i].actualcost;
            }
            $scope.totalRt = totalRt;
            $scope.totalPMoney = totalMoney;
        });
    };

    this.bussesMTjs = function (proId) {
        var date = new Date;
        var year = date.getFullYear();
        CertusFormAjax.ajax('findBussesTjs', {
            "param": proId,
            "year": year,
            "compCode": ""
        }, function (response) {
            var data = response.data;
            var treimlist = data.ntreimList;
            var totalBussMoney = 0;
            for (var i = 0; i < treimlist.length; i++) {
                totalBussMoney += treimlist[i].totalMoney;
            }
            $scope.totalBuss = totalBussMoney;
        });
    }

    this.bussesType = function (proId) {
        var date = new Date;
        var year = date.getFullYear();
        CertusFormAjax.ajax('findMBusessTypeByPro', {
            "param": proId,
            "year": year,
            "compCode": ""
        }, function (response) {
            var data = response.data;
            var bxtotalMoney = 0;
            for (var i = 0; i < data.length; i++) {
                bxtotalMoney += data[i].totalMoney;
            }
            $scope.bxMoney = bxtotalMoney;
        });
    };

    this.assetMs = function (proId) {
        var date = new Date;
        var year = date.getFullYear();
        CertusFormAjax.ajax('findAssetMs', {
            "param": proId,
            "year": year,
            "compCode": ""
        }, function (response) {
            var data = response.data;
            var totalMoney = 0;
            for (var i = 0; i < data.length; i++) {
                totalMoney += data[i].totalMoney;
            }
            $scope.zjMoney = totalMoney;
        })
    };

    //开票和回款按月统计
    this.kpAndHkTjs = function (proId) {
        var date = new Date;
        var year = date.getFullYear();
        CertusFormAjax.ajax('findPayTjs', {
            "param": proId,
            "year": year,
            "compCode": ""
        }, function (response) {
            var payList = response.data.payList;
            var invoiceList = response.data.invoiceList;
            var kptotalMoney = 0;
            var hktotalMoney = 0;
            for (var i = 0; i < invoiceList.length; i++) {
                hktotalMoney += invoiceList[i].buget;
            }
            for (var i = 0; i < payList.length; i++) {
                kptotalMoney += payList[i].buget;
            }
            $scope.kpandhkmoney = kptotalMoney + hktotalMoney;
            $scope.kptotalMoney = kptotalMoney;
            $scope.hktotalMoney = hktotalMoney;
        });
    };

    //项目采购按月分布
    this.cgTjs = function (proId) {
        var date = new Date;
        var year = date.getFullYear();
        CertusFormAjax.ajax('findCgTjs', {
            "param": proId,
            "year": year,
            "compCode": ""
        }, function (response) {
            var data = response.data;
            var yctjs = data.cgycs;
            var sjtjs = data.cgsjs;
            var cgtotalMoney = 0;
            var cgsymoney = 0;
            for (var i = 0; i < sjtjs.length; i++) {
                if (sjtjs[i].code == "SY") {
                    cgsymoney += yctjs[i].totalMoney;
                } else if (sjtjs[i].code == "ZY") {
                    cgtotalMoney += yctjs[i].totalMoney;
                } else {
                    cgtotalMoney += yctjs[i].totalMoney;
                }
            }
            $scope.cgFsyMoney = cgtotalMoney;
            $scope.cgysymoney = cgsymoney;
            var cgMoney = cgtotalMoney + cgsymoney;
            $scope.cgMoney = cgMoney;
        });
    };

    //预测费用
    CertusFormAjax.ajax("findTotalMoney", {
        "proId": $scope.proId,
        "status": 1,
        "isFy":1
    }, function (response) {
        $scope.ycMoney = response.data;
    });

    //未批准费用
    CertusFormAjax.ajax('findWpzMoney', {
        "proId": $scope.proId,
        'status':2
    }, function (response) {
        $scope.wpzMoney = response.data;
    });

    CertusFormAjax.ajax('findZdMoney', {
        "projId": $scope.proId
    }, function (response) {
        $scope.zdMoney = response.data;
    });

    phaseTjs($scope.proId);
    bussesMTjs($scope.proId);
    bussesType($scope.proId);
    assetMs($scope.proId);
    cgTjs($scope.proId);
    kpAndHkTjs($scope.proId);

    CertusFormAjax.ajax('findProContract', {
        "proId": $scope.proId
    }, function (response) {
        var other2Columns = [{
                id: 'contractName',
                title: '合同名称',
                type: 'string',
                width: 200,
                columnClass: 'text-center',
            }, {
                id: 'contractNo',
                title: '合同编号',
                type: 'string',
                width: 200,
                columnClass: 'text-center',
            }, {
                id: 'contractAmount',
                title: '合同金额',
                type: 'string',
                width: 150,
                columnClass: 'text-center',
                resolution: function (value, record, column, grid, dataNo, columnNo) {
                    var content = '￥' + value + '元';
                    return content;
                  }
            }, {
                id: 'consignee',
                title: '签订人',
                type: 'string',
                width: 75,
                columnClass: 'text-center'
            }, {
                id: 'contractSignTime',
                title: '签订时间',
                type: 'date',
                width: 110,
                format: 'yyyy-MM-dd',
                otype: 'time_stamp_ms',
                columnClass: 'text-center'
            },
            //     {
            //     id: 'softIncome',
            //     title: '软件收入',
            //     type: 'string',
            //     columnClass: 'text-center',
            // },{
            //     id: 'notSoftIncome',
            //     title: '非软件收入',
            //     type: 'string',
            //     columnClass: 'text-center',
            // },
            {
                id: 'keyTerms',
                title: '关键条款',
                type: 'string',
                columnClass: 'text-left'
            }
        ];

        $("#lpro_5Container").empty();
        var other2Option = {
            lang: 'zh-cn',
            ajaxLoad: false,
            extraWidth: 20,
            // loadURL:'url',
            exportFileName: '合同信息',
            datas: response.data,
            columns: other2Columns,
            gridContainer: 'lpro_5Container',
            tools: ''
        };
        var other1Grid = $.fn.dlshouwen.grid.init(other2Option);
        other1Grid.load();
    });
    //报销费用
    CertusFormAjax.ajax("findBxInfo", {
        "projId": $scope.proId,
        "status": 0
    }, function (response) {
        var other2Columns = [{
            id: 'tri_class_name',
            title: '类型',
            type: 'string',
            width: 150,
            columnClass: 'text-center',
        }, {
            id: 'money',
            title: '金额',
            type: 'string',
            width: 150,
            columnClass: 'text-center',
            resolution: function (value, record, column, grid, dataNo, columnNo) {
                var content = '￥' + value + '元';
                return content;
              }
        }, {
            id: 'user_name',
            title: '申请人',
            type: 'string',
            width: 75,
            columnClass: 'text-center'
        }, {
            id: 'create_time',
            title: '申请时间',
            type: 'date',
            width: 110,
            format: 'yyyy-MM-dd',
            otype: 'time_stamp_ms',
            columnClass: 'text-center'
        }, {
            id: 'useTimeSycle',
            title: '使用周期',
            type: 'string',
            width: 220,
            columnClass: 'text-center',
            resolution: function (value, record, column, grid, dataNo, columnNo) {
                var content = '';
                content += record.start_date + "至" + record.end_date;
                return content;
            }
        }, {
            id: 'tr_instruction',
            title: '费用说明',
            type: 'string',
            columnClass: 'text-left'
        }];

        $("#lpro_4Container").empty();

        var other2Option = {
            lang: 'zh-cn',
            ajaxLoad: false,
            extraWidth: 20,
            // loadURL:'url',
            exportFileName: '其他费用',
            datas: response.data,
            columns: other2Columns,
            gridContainer: 'lpro_4Container',
            tools: ''
        };
        var other1Grid = $.fn.dlshouwen.grid.init(other2Option);
        other1Grid.load();
    });

    CertusFormAjax.ajax("findBxTotalMoney", {
        "projId": $scope.proId
    }, function (response) {
        $scope.bxTotalMoney = response.data;
        $scope.xjMoney = response.data;
    });

    setTimeout(function () {
        var proTMoney = $scope.totalPMoney +
            $scope.cgMoney + $scope.bxTotalMoney +
            $scope.zjMoney;
        $("#proTMoney").html(proTMoney);
    },500);

    CertusFormAjax.ajax("findBugetInfo2", {
        "proId": $scope.proId,
        "status": 1,
        "isFy":1
    }, function (response) {
        // 立项信息-项目指标
        var other2Columns = [{
            id: 'buget_phase',
            title: '阶段',
            type: 'string',
            width: 75,
            columnClass: 'text-center',
        }, {
            id: 'buget_type',
            title: '预估类型',
            type: 'string',
            width: 200,
            columnClass: 'text-center',
        }, {
            id: 'fmBuget',
            title: '金额',
            type: 'string',
            width: 150,
            columnClass: 'text-center',
            resolution: function (value, record, column, grid, dataNo, columnNo) {
                var content = '￥' + value + '元';
                return content;
              }
        }, {
            id: 'user_name',
            title: '申请人',
            type: 'string',
            width: 75,
            columnClass: 'text-center'
        }, {
            id: 'create_time',
            title: '申请时间',
            type: 'date',
            width: 110,
            format: 'yyyy-MM-dd',
            otype: 'time_stamp_ms',
            columnClass: 'text-center'
        }, {
            id: 'useTimeSycle',
            title: '使用周期',
            type: 'string',
            width: 220,
            columnClass: 'text-center',
            resolution: function (value, record, column, grid, dataNo, columnNo) {
                var content = '';
                if(record.budgetBegin!=undefined){
                    content += record.budgetBegin + "至" + record.budgetEnd;
                }
                return content;
            }
        }, {
            id: 'comments',
            title: '费用说明',
            type: 'string',
            columnClass: 'text-left'
        }];

        $("#lpro_2Container").empty();
        var other2Option = {
            lang: 'zh-cn',
            ajaxLoad: false,
            extraWidth: 20,
            // loadURL:'url',
            exportFileName: '其他费用',
            datas: response.data,
            columns: other2Columns,
            gridContainer: 'lpro_2Container',
            tools: ''
        };
        var other1Grid = $.fn.dlshouwen.grid.init(other2Option);
        other1Grid.load();
    });

    CertusFormAjax.ajax("findYsBugetInfo", {
        "proId": $scope.proId,
        "status": 1
    }, function (response) {
        // 立项信息-项目指标
        var other2Columns12 = [{
            id: 'buget_phase',
            title: '阶段',
            type: 'string',
            width: 75,
            columnClass: 'text-center',
        }, {
            id: 'buget_type',
            title: '预算类型',
            type: 'string',
            width: 200,
            columnClass: 'text-center',
        }, {
            id: 'buget',
            title: '预算金额',
            type: 'string',
            width: 150,
            columnClass: 'text-center',
            resolution: function (value, record, column, grid, dataNo, columnNo) {
                var content = '￥' + value + '元';
                return content;
              }
        }, {
            id: 'user_name',
            title: '申请人',
            type: 'string',
            width: 75,
            columnClass: 'text-center'
        }, {
            id: 'create_time',
            title: '申请时间',
            type: 'date',
            width: 110,
            format: 'yyyy-MM-dd',
            otype: 'time_stamp_ms',
            columnClass: 'text-center'
        }, {
            id: 'useTimeSycle',
            title: '使用周期',
            type: 'string',
            width: 220,
            columnClass: 'text-center',
            resolution: function (value, record) {
                var content = '';
                content += record.budgetBegin + "至" + record.budgetEnd;
                return content;
            }
        }, {
            id: 'comments',
            title: '费用说明',
            type: 'string',
            columnClass: 'text-left'
        }, {
            id: 'budget_status',
            title: '状态',
            type: 'string',
            columnClass: 'text-center',
            resolution: function (value, record) {
                var content = '';
                if (value==0){
                    content="申请中";
                }else if (value==1){
                    content="审批通过";
                }else{
                    content="未审批";
                }
                return content;
            }
        }];

        $("#otherContainer").empty();
        var other2Option = {
            lang: 'zh-cn',
            ajaxLoad: false,
            extraWidth: 20,
            // loadURL:'url',
            exportFileName: '预算申请',
            datas: response.data,
            columns: other2Columns12,
            gridContainer: 'otherContainer',
            tools: ''
        };
        var other1Grid = $.fn.dlshouwen.grid.init(other2Option);
        other1Grid.load();
    });

    // CertusFormAjax.ajax("findYsBuget", {
    //     "proId": $scope.proId
    // }, function (response) {
    //     // 立项信息-项目指标
    //     var other2Columns = [{
    //         id: 'buget_phase',
    //         title: '阶段',
    //         type: 'string',
    //         width: 75,
    //         columnClass: 'text-center',
    //     }, {
    //         id: 'buget_type',
    //         title: '预算类型',
    //         type: 'string',
    //         width: 150,
    //         columnClass: 'text-center',
    //     }, {
    //         id: 'fmBuget',
    //         title: '预算金额',
    //         type: 'string',
    //         width: 150,
    //         columnClass: 'text-center',
    //         resolution: function (value, record, column, grid, dataNo, columnNo) {
    //             var content = '￥' + value + '元';
    //             return content;
    //           }
    //     }, {
    //         id: 'user_name',
    //         title: '申请人',
    //         type: 'string',
    //         width: 75,
    //         columnClass: 'text-center'
    //     }, {
    //         id: 'create_time',
    //         title: '申请时间',
    //         type: 'date',
    //         width: 110,
    //         format: 'yyyy-MM-dd',
    //         otype: 'time_stamp_ms',
    //         columnClass: 'text-center'
    //     }, {
    //         id: 'useTimeSycle',
    //         title: '使用周期',
    //         type: 'string',
    //         width: 220,
    //         columnClass: 'text-center',
    //         resolution: function (value, record) {
    //             var content = '';
    //             content += record.budgetBegin + "至" + record.budgetEnd;
    //             return content;
    //         }
    //     }, {
    //         id: 'comments',
    //         title: '费用说明',
    //         type: 'string',
    //         columnClass: 'text-left'
    //     }];
    //
    //     $("#otherContainer").empty();
    //     var other2Option = {
    //         lang: 'zh-cn',
    //         ajaxLoad: false,
    //         extraWidth: 20,
    //         // loadURL:'url',
    //         exportFileName: '其他费用',
    //         datas: response.data,
    //         columns: other2Columns,
    //         gridContainer: 'otherContainer',
    //         tools: ''
    //     };
    //     var other1Grid = $.fn.dlshouwen.grid.init(other2Option);
    //     other1Grid.load();
    // });

    CertusFormAjax.ajax("findYsBuget", {
        "proId": $scope.proId,
        "status": 0
    }, function (response) {
        var other1Columns = [{
            id: 'buget_phase',
            title: '阶段',
            type: 'string',
            width: 75,
            columnClass: 'text-center',
        }, {
            id: 'buget_type',
            title: '预算类型',
            type: 'string',
            columnClass: 'text-center',
        }, {
            id: 'buget',
            title: '预算金额',
            type: 'string',
            width: 150,
            columnClass: 'text-center',
            resolution: function (value, record, column, grid, dataNo, columnNo) {
                var content = '￥' + value + '元';
                return content;
              }
        }, {
            id: 'user_name',
            title: '预估人',
            type: 'string',
            width: 75,
            columnClass: 'text-center'
        }, {
            id: 'create_time',
            title: '预估时间',
            type: 'date',
            format: 'yyyy-MM-dd',
            otype: 'time_stamp_ms',
            width: 110,
            columnClass: 'text-center'
        }];
        $("#lpro_1Container").empty();
        var other1Option = {
            lang: 'zh-cn',
            ajaxLoad: false,
            // loadURL:'url',
            extraWidth: 20,
            exportFileName: '其他费用',
            datas: response.data,
            columns: other1Columns,
            gridContainer: 'lpro_1Container',
            tools: ''
        };
        var other1Grid = $.fn.dlshouwen.grid.init(other1Option);
        other1Grid.load();
    });
}